<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ace="http://www.icefaces.org/icefaces/components"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
  <h:head>
    <title>Facelet Title</title>
  </h:head>

  <h:body>
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:f="http://java.sun.com/jsf/core"
                    xmlns:c="http://java.sun.com/jsp/jstl/core"
                    xmlns:ace="http://www.icefaces.org/icefaces/components"
                    xmlns:icecore="http://www.icefaces.org/icefaces/core"
                    xmlns:ui="http://java.sun.com/jsf/facelets"
                    template="layout.xhtml">
      <ui:define name="title">My messages / Awesome Dates</ui:define>
      <ui:define name="content">

        <ace:panel header="Inbox">
          <h:form>
            <ace:dataTable value="#{messageManager.lstMessages}" var="c" style="width: auto" >
              <ace:column id="id" headerText="From" style="width: 200px">
                <h:outputText id="idCell" value="#{c.sendingUser.username}"/>
              </ace:column>
              <ace:column id="name" headerText="Subject" style="width: 400px">
                <h:commandLink value="#{c.subject}" action="#{messageManager.readMessage(c.sendingUser.username,c.messageID)}"/>
              </ace:column>
              <ace:column headerText="Date" style="width: 200px">
                <h:outputText  value="#{c.date}"/>
              </ace:column>
              <ace:column  headerText="Delete" style="width: 100px">
                <h:commandLink value="Delete" action="#{messageManager.delete(c.messageID)}">
                  <f:ajax render="@form"/>
                </h:commandLink>
              </ace:column>
            </ace:dataTable>
          </h:form>
        </ace:panel>
      </ui:define>
    </ui:composition>
  </h:body>
</html>

